﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Tinter.Common.Validation
{
    public interface IObjectValidator
    {
        /// <summary>
        /// Perform validation and return if the object state is valid.
        /// </summary>
        /// <returns>True if object state is valid</returns>
        bool IsValid();

        /// <summary>
        /// Return the collection of errors if entity state is not valid
        /// </summary>
        /// <typeparam name="TEntity">The type of entity</typeparam>
        /// <param name="item">The instance with validation errors</param>
        /// <returns>A collection of validation errors</returns>
        IEnumerable<String> GetInvalidMessages<TEntity>(TEntity item)
            where TEntity : class;
    }
}
